# !/usr/bin/env python
# coding=utf-8
# @Time    : 2018/1/5 15:57
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/wx_server_prototype.git
# @File    : transaction.py
# @Software: PyCharm
# @Version: 3.5.4
from flask import request
from configs import current_config
from . import api
from app.service import pingpp_service
from app.common import my_response


@api.route(current_config.API_PREFIX + '/transaction/p_pay', methods=['POST'])
def p_pay():
	"""
	:param post_json: {
		'order_no'
		'amount'
		'subject'
		'body'
		'open_id'
	}
	:return:
	"""
	para = request.get_json()
	order_no = para['order_no']
	amount = para['amount']
	client_ip = request.remote_addr
	subject = para['subject']
	body = para['body']
	open_id = para['open_id']
	charge = pingpp_service.get_charge(order_no, amount, client_ip, subject, body, open_id)
	return my_response.success(charge)
